#ifndef __GDT_H__
#define __GDT_H__

#include <asm/type.h>
#include <macros.h>



typedef struct {
    u16_t limit_l;
    u16_t base_l;
    u8_t base_m;
    u8_t access_type;
    unsigned limit_h : 4;
    unsigned flags : 4;
    u8_t base_h;
} __attribute__((packed)) gdt_entry_t;

extern gdt_entry_t GdtTable[GDTNUM];
    
typedef struct SysSegDesc {
    u16_t limit_l;
    u16_t base_l;
    u8_t base_m0;
    u8_t access_type;
    unsigned limit_h : 4;
    unsigned flags : 4;
    u8_t base_m1;
    u32_t base_h;
    u32_t rev;
} __attribute__((packed)) sys_seg_desc_t; // TSS指向GDT[10:11]

extern sys_seg_desc_t TssSeg;

extern void init_gdt();

#endif